<template>
    <div class="h-100">
        <div class="h-100 flex row-center col-center" v-if="loading">
            <van-loading/>
        </div>

        <div class="h-100 flex row-center col-center f14" v-if="!loading && (listData.length === 0)">暂无企业基本信息</div>
        <van-cell v-for="(item, index) of listData" :key="index" :title="item.name" :value="item.value"></van-cell>
    </div>
</template>

<script>
    import cy from '../mixins/cy';

    export default {
        mixins: [cy],
        props: {
            // 企业 ID
            id: {
                type: String,
                default: ''
            },
            // 企业类型
            dataType: {
                type: String,
                default: ''
            }
        },
        data() {
            return {
                // 数据源
                listData: [],
                // 其他
                // 是否正在加载：true-是；false-否
                loading: false
            }
        },
        mounted() {
            this.loading = true;

            this.$$getEnBaseInfo({
                id: this.id,
                data_type: this.dataType
            }).then(data => {
                let dataVo = data.content[0];

                // 参照安全云APP
                this.listData = [
                    {
                        name: '企业名称',
                        value: dataVo.name
                    },
                    {
                        name: '工商注册号',
                        value: dataVo.reg_number
                    },
                    {
                        name: '工商登记机关',
                        value: dataVo.gsdjjg
                    },
                    {
                        name: '工商登记日期',
                        value: dataVo.gsdjrq
                    },
                    {
                        name: '行业类别',
                        value: dataVo.industry_category_name
                    },
                    {
                        name: '所属监管行业',
                        value: dataVo.superviseIndustryName
                    },
                    {
                        name: '组织机构代码',
                        value: dataVo.org_code
                    },
                    {
                        name: '成立日期',
                        value: dataVo.found_date ? this.$date(new Date(dataVo.found_date), 'yyyy-MM-dd') : ""
                    },
                    {
                        name: '法定代表人',
                        value: dataVo.legal_person
                    },
                    {
                        name: '联系电话	',
                        value: dataVo.contact_phone
                    },
                    {
                        name: '法定代表人-办公室电话',
                        value: dataVo.frdbyddh
                    },
                    {
                        name: '法定代表人-移动电话',
                        value: dataVo.frdbyddh
                    },
                    {
                        name: '电子邮箱',
                        value: dataVo.email
                    },
                    {
                        name: '邮政编码',
                        value: dataVo.post_encoding
                    },
                    {
                        name: '经济类型',
                        value: dataVo.economic_type == '999' ? '' : dataVo.economic_type
                    },
                    {
                        name: '行政区划',
                        value: dataVo.address
                    },
                    {
                        name: '行政隶属',
                        value: dataVo.relationshipStr
                    },
                    {
                        name: '企业状态',
                        value: dataVo.enterprise_state == '0' ? '有效' : '无效'
                    },
                    {
                        name: '经度',
                        value: '' + this.$getString(dataVo.longitude_d) + '°' + this.$getString(dataVo.longitude_m) + '′' + this.$getString(dataVo.longitude_s) + '″'
                    },
                    {
                        name: '纬度',
                        value: '' + this.$getString(dataVo.latitude_d) + '°' + this.$getString(dataVo.latitude_m) + '′' + this.$getString(dataVo.latitude_s) + '″'
                    },
                    {
                        name: '联系人',
                        value: dataVo.contacts
                    },
                    {
                        name: '企业生产状态',
                        value: dataVo.produce_state_name
                    },
                    {
                        name: '注册地址',
                        value: dataVo.administrative_division_name
                    },
                    {
                        name: '经营范围',
                        value: dataVo.business_scope
                    }
                ];

                this.loading = false;
            }).catch(e => {
                console.error(e);

                this.loading = false;
            });
        }
    }
</script>
